﻿@model QsdRenderModel
@{
    var QsdItem = Model.CurrentItem;
    var typeval = Model.TypeVal;
    var QsdItemId = Model.ItemName;
    var deep = Model.CurrentDeepLvl;
    var AllQSDs = Model.AllSubItems;
}
@*@if (QsdItem.QizSubjectDefine.ThresholdLow != null)
{
    //string normalValue = string.Empty;
    {
        string[] temps = QsdItem.QizSubjectDefine.ThresholdLow.Split(new char[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
        foreach (var temp in temps)
        {
            normalValue += @QsdItem.QizSubjectDefine.QizItem.EnumDefine.EnumValues.FirstOrDefault(s => s.EnumValID == temp).OptionTitle + "，";
        }
        normalValue = normalValue.TrimEnd('，');
    }
<span>(正常值范围: @normalValue)</span>
}*@
<ol class="enumvalues">
    @{
        foreach (var selitem in QsdItem.QizSubjectDefine.QizItem.EnumDefine.EnumValues)
        {
            var selitemid = "Val_" + QsdItem.ID + "_" + selitem.EnumValID;
            var selitemsubid = "quizsd_" + selitem.EnumValID + "_" + QsdItem.ID;
        <li>
            <input name="@QsdItemId" type="@(typeval == "4" ? "Radio" : "CheckBox")"
                                value="@(selitem.EnumValID)" @(null != QsdItem.UserSelValue && QsdItem.UserSelValue.Contains(selitem.EnumValID) ? "Checked='Checked'" : "")
                                id="@(selitemid)" selitemsubid = "@(selitemsubid)" />
            <label for='@selitemid'>
                @Html.DisplayFor(model => selitem.OptionTitle) @(string.IsNullOrEmpty(selitem.OptionDescription) ? "" : "--")
                @Html.DisplayFor(model => selitem.OptionDescription)</label>
        </li>
        }
    }
</ol>
@if (QsdItem.QizSubjectDefine.ChildSubjDefs.Count > 0)
{
    QizSession OriModel=TempData["OriQizSessionModel"] as QizSession; 
    var qsdgps = OriModel.QizSessionDetails.Where(v => QsdItem.QizSubjectDefine.ChildSubjDefs.Contains(v.QizSubjectDefine))
.OrderBy(v => v.QizSubjectDefine.SortIdx).GroupBy(v => v.QizSubjectDefine.ParentSubjDefVals);
    foreach (var gp in qsdgps)
    {
        @Html.Partial("QsdRenders/QsdBody", new QsdRenderModel()
                            {
                                AllSubItems = gp,
                                CurrentItem = QsdItem,
                                CurrentDeepLvl = deep + 1,
                                ParentID = gp.Key + "_" + QsdItem.ID
                            });
    }
}
